/**
 * Project Name:JNIProjectDemo
 * Package Name:com.xuwei.jni.objectoper
 * author:David
 * Date:2016年5月23日上午11:45:10
 * Copyright (c) 2016, xw123box@126.com All Rights Reserved.
 *
 */
package com.xuwei.jni.objectoper;

import org.junit.Test;

/**
 * @author David
 * @since 2016年5月23日 上午11:45:10
 * @version 
 * @since JDK 1.6
 */
public class FieldAccess {
	private String s;
	private static int si;
	private native void accessField();
	private native void accessStaticField();
	
	static{
		System.loadLibrary("assets/objectField_x64");
	}
	
	
	@Test
	public void testAccessInstanceField(){
		System.out.println("==========访问实例属性========");
		FieldAccess c = new FieldAccess();
        c.s = "abc";
        c.accessField();
        System.out.println("In Java:");
        System.out.println("  instance field s = \"" + c.s + "\"");
	}
	
	@Test
	public void testAccessStaticField(){
		FieldAccess c = new FieldAccess();
		System.out.println("==========访问静态属性=========");
        c.si = 100;
        c.accessStaticField();
        System.out.println("In Java:");
        System.out.println("  static field si = \""+c.si+"\"");
	}
	
	
	
}
